from public.tools import *
from public.action import *
from public.testDATE import *

from selenium.webdriver.common.keys import Keys
testCase="DBshop012_管理搜索商品"
SP="美的"
firefox=openB(adminurl)
adminlogin(firefox)
menu2(firefox,"商品管理","管理商品")
# "1.选择商品名称，输入“美的”，点击“搜索”按钮。
firefox.find_element_by_xpath("//input[@class='span11' and @name='goods_name']").send_keys(SP)
firefox.find_element_by_xpath("//button[@type='submit']").click()

# 2.搜索成功美的的后台商品"
s=firefox.find_element_by_xpath("//tr[2]/td[3]").text
print(s)
l="^"
r="（"
time.sleep(4)
Name=reGetString(s,l,r)
print(Name)
if Name == SP:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()